<html>
<head><meta charset="utf-8"><title>Elided lifetime diagnostics · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Elided.20lifetime.20diagnostics.html">Elided lifetime diagnostics</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="244654999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Elided%20lifetime%20diagnostics/near/244654999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> inquisitivecrystal <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Elided.20lifetime.20diagnostics.html#244654999">(Jul 02 2021 at 03:00)</a>:</h4>
<p>Hi, <span class="user-mention" data-user-id="125294">@Aaron Hill</span>! I was looking at implementing <a href="https://github.com/rust-lang/rust/issues/86759">#86759</a>, and I had a few questions about your comment there.</p>
<p>1) What is it about this particular example that would make the message from E0312 helpful and the one from E0621 unhelpful? I'm guessing that it's not <em>always</em> the case that E0621 isn't helpful, but I don't know.</p>
<p>2) More specifically, I noticed that this produced an even less helpful error before your PR <a href="https://github.com/rust-lang/rust/issues/85240">#85240</a>. Would adding an else to the if statement you inserted in that PR be a good way to produce a more helpful diagnostic for this case?</p>



<a name="244655117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Elided%20lifetime%20diagnostics/near/244655117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Elided.20lifetime.20diagnostics.html#244655117">(Jul 02 2021 at 03:03)</a>:</h4>
<p>My thinking is that in this case, the non-elided lifetime error shows strictly more information</p>



<a name="244655156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Elided%20lifetime%20diagnostics/near/244655156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Elided.20lifetime.20diagnostics.html#244655156">(Jul 02 2021 at 03:04)</a>:</h4>
<p>It points to the usage, but also points to the lifetime drfinition</p>



<a name="244655170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Elided%20lifetime%20diagnostics/near/244655170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Elided.20lifetime.20diagnostics.html#244655170">(Jul 02 2021 at 03:04)</a>:</h4>
<p>and explains what's going on</p>



<a name="244655243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Elided%20lifetime%20diagnostics/near/244655243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Elided.20lifetime.20diagnostics.html#244655243">(Jul 02 2021 at 03:06)</a>:</h4>
<p>Rather than modifying my other PR, I think it would be better to try to go through the code that emits the larger error</p>



<a name="244655285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Elided%20lifetime%20diagnostics/near/244655285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Elided.20lifetime.20diagnostics.html#244655285">(Jul 02 2021 at 03:07)</a>:</h4>
<p>I'm also not sure if we should remove the 'anonynous' error E0621 entirely. I'll do some digging, and get back to you</p>



<a name="244655444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Elided%20lifetime%20diagnostics/near/244655444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> inquisitivecrystal <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Elided.20lifetime.20diagnostics.html#244655444">(Jul 02 2021 at 03:10)</a>:</h4>
<p>I've already done a lot of the digging. I can send you some links.</p>



<a name="244655750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Elided%20lifetime%20diagnostics/near/244655750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> inquisitivecrystal <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Elided.20lifetime.20diagnostics.html#244655750">(Jul 02 2021 at 03:18)</a>:</h4>
<p>The code for the more helpful error is <a href="https://github.com/rust-lang/rust/blob/bc6330d47a7a81e25f492a837822121a3cd88158/compiler/rustc_infer/src/infer/error_reporting/note.rs#L144">here in <code>report_concrete_failure</code></a>. The line that decides not to go down that path is <a href="https://github.com/Aaron1011/rust/blob/bc6330d47a7a81e25f492a837822121a3cd88158/compiler/rustc_infer/src/infer/error_reporting/mod.rs#L341">here</a>, which indirectly invokes <a href="https://github.com/rust-lang/rust/blob/952c5732c2d25a875f90e5cd5dd29a1a21c1d4a2/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/named_anon_conflict.rs#L13"><code>try_report_named_anon_conflict</code></a>. <code>try_report_named_anon_conflict</code> is also where error E0621 is emitted.</p>



<a name="244655847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Elided%20lifetime%20diagnostics/near/244655847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> inquisitivecrystal <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Elided.20lifetime.20diagnostics.html#244655847">(Jul 02 2021 at 03:21)</a>:</h4>
<p>Hypothetically, if we got rid of E0621 entirely, that would just be a matter of getting rid of <code>try_report_named_anon_conflict</code>. If there's some subset of cases where E0621 shouldn't be given, it's probably a matter of putting a condition in <code>try_report_named_anon_conflict</code>.</p>



<a name="244655882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Elided%20lifetime%20diagnostics/near/244655882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> inquisitivecrystal <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Elided.20lifetime.20diagnostics.html#244655882">(Jul 02 2021 at 03:22)</a>:</h4>
<p>You'll probably see things I'm missing, but that should hopefully get you started.</p>



<a name="245394379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Elided%20lifetime%20diagnostics/near/245394379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> inquisitivecrystal <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Elided.20lifetime.20diagnostics.html#245394379">(Jul 09 2021 at 02:40)</a>:</h4>
<p><span class="user-mention" data-user-id="125294">@Aaron Hill</span> Have you had a chance to take a look at this?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>